<?php
  include("depart_info.inc");
  //show staffrooms
  $sql = 'select * from staffroom where staffroom.depart_ID='.$_GET['d_id'].';';
  $result = mysql_query($sql) or die('Query failed: ' . mysql_error());
  mysql_close($link);
?>
<td valign="top" class="style3">
<span  align="center">
  <table align="center" class="style2"  width="550">
    <tr>
      <th>ID</th>
      <th>Name of staff room</th>
      <th>Delete</th>
      <th>Edit</th>
    </tr>
    <?php
      while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) {
        echo "<tr>\n\t<td>";
        echo $line['sr_ID'];
        echo "</td>\n<td>";
        echo "<a href=\"show_teacher.php?sr_id=";
        echo $line['sr_ID'];
        echo "\">".$line['sr_full_name']."</a>";
        echo "</td><td><a Onclick=\"if(!confirm('Do you want to delete?')) return false;\" href=\"";
        echo $_SERVER['PHP_SELF'].'?sr_id='.$line['sr_ID'].'&d_id='.$line['depart_ID']; 
        echo "\">delete</a></td><td><a href=\"edit_staffroom.php?sr_id=";
        echo $line['sr_ID'];
        echo "\">edit</a></td>\n</tr>\n";
      }
    ?>
    <tr>
      <td></td><td></td><td></td><td align="center"><a href="add_staffroom.php?d_id=<?php echo $_GET['d_id'];?>">Add</a></td>
    </tr>
  </table>
</span>
</td>
</tr>
</table>
<br /><br />

<?php
  mysql_free_result($result);  
?>
